    <br><br>
    <br><br>
    <br><br>
   <?php foreach($records as $row) { ?>  
    <div class="container">
        <div class="row">
            <div class="col-md-10 col-md-offset-1">
                <div class="panel panel-default" >
                    <div class="panel-heading" >
                       
                        <h3 >
                        <?php echo $row->note_title; ?>
                        </h3>
                    </div>
                     
                    <div class="panel-body">
                        <div class="pull-right">
                           <div style="margin-left:30px;"><b>Downloads</b><p id="div" style="margin-top:-22px; margin-left:-30px;">$row->downloads; </p></div>
                            <input type="hidden" value="<?php echo $row->downloads; ?>" id="cur_downloads">
                            <input type="hidden" value="<?php echo $row->notes_id; ?>" id="notes_id">

                            <a id="dwn" href="<?php echo $row->softcopy; ?>" class="btn btn-primary" download="<?= $row->note_title ?>"> Download</a>

                        </div>
                        
                        <div class="pull-left">
                            <p><b>Posted by:</b></p>
                        </div>
                        
                        <div class="img-div-xsml" style="margin-top:-10px; margin-left:80px;" >
                            <img src=" <?php echo $row->dp; ?>" />
                        </div> 
                        <p style="margin-top:-40px; margin-left:140px;"><b><?php echo $row->full_name; ?></b></p>
                        <br>
                        
                        <div class="pull-left">
                            <p><b>Semester:</b> <?php echo $row->semester; ?></p>
                            <p><b>Auther/Teacher:</b> <?php echo  $row->author; ?></p>
                            <p><b>Discription:</b><?php echo $row->disc; ?> </p>
                            
                        </div>
                        
                    </div>
                    
                </div> 
            </div>
        </div>  
            <div class="row">
                <div class="col-md-10 col-md-offset-1">
                    <div class="panel panel-default" >
                        <div class="panel-heading" >
                            <h3>
                            Comments
                            </h3>
                        </div>
                        <div class="panel-body" id="comments">
                            <?php $i=0;
                             foreach ($comments as $com) { ?>

                           
                            <div class="row"><!--start of com div-->
                                   <div class="col-md-1">
                                        <div class="pull-left">
                                            <div class="img-div-xsml" >
                                                <img src="<?= $com->dp ?>" />
                                            </div>

                                            <b><?=$com->full_name ?></b>
                                        </div>
                                    </div>
                          
                                    <div class="col-md-11">
                                            <p> <?= $com->text ?></p>
                                            <a href="#"><b>Delete</b></a>
                                    </div>
                                    <hr>
                            </div> <!--end of com div--><br>
                         <?php }?>
                            
                         </div>
                                <?php
                                        
                         if($this->session->userdata('user_id') ) 
                                            {
                             ?>
                                                    <div class="panel-footer">
                                                        <div class="row">
                                                             <div class="col-md-1 ">
                                                                <div class="pull-left">
                                                                    <div class="img-div-xsml" >

                                                                        <img src="<?= $this->session->userdata('dp') ?>" />
                                                                    </div>

                                                                <b><?= $this->session->userdata('username') ?></b>
                                                                </div>
                                                             </div>
                                                             <div class="col-md-11 ">
                                                                <textarea id="commentBox" class="form-control" name="comment"></textarea>
                                                                <input type="hidden" id="userId" value="<?= $this->session->userdata('user_id') ?>">
                                                                <input type="hidden" id="url" value="<?= base_url() ?>">
                                                                <input type="hidden" id="fname" value="<?= $this->session->userdata('username') ?>">
                                                                <input type="hidden" id="ad_id" value="<?= $this->uri->segment(3) ?>">
                                                                 <br>
                                                                 <button id="commentBtn" class="btn btn-primary">Comment</button>
                                                            </div>
                                                      </div> 
                                                    </div>
                                                </div>
           
       
                                      <?php  }
                            else{
            ?> 
                    <div class='alert alert-danger' role='alert' style='width:80%; margin-left:10px; margin-top:10px;'> For comment you must be loged in </div>
                     <?php        } ?>
                </div>
             </div>
        
    </div>
    
    <?php } ?>
    